/**
 * @Author YuanYuan
 * @Date 2022/9/10
 * @Time 10:20
 */
public class TestDemo1 {
    private static boolean isQuit = false;
    public static void main(String[] args)  {
        Thread thread = new Thread(()-> {
            while (!Thread.currentThread().isInterrupted()) {
                System.out.println(Thread.currentThread().isInterrupted());
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                    //break;
                }
            }
            System.out.println("thread 线程执行完了");

        });

        Thread.currentThread();
        thread.start();

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("中断线程");
        thread.interrupt();
        System.out.println("isQuit 为真");



    }
}
